<!DOCTYPE html>
<head>
	
</head>
<body>
	<input type="text" id="fname" onchange="myFunction()">

	<script>

		//document.getElementById("fname").addEventListener("onchange", myFunction);
		function myFunction(){
			var x = document.getElementById("fname");
			x.value = x.value.toUpperCase();
			//alert(typeof document.getElementById("fname"));
			//alert(x.textContent);
		}
		
	
	</script>
</body>
</html>